/**
 * Applikationsutveckling i Java, 5DV135
 * HT12
 * Project
 * 
 * File: JunctionTest.java
 * Description: A JUnitTestCaseClass used to test the class
 * 				Junction
 * Date: 18 december 2012
 * 
 * cs-user: dv11mgr
 * @author Maria Gramner
 */

package nullInvader.Test;
import nullInvader.Engine.Junction;
import junit.framework.TestCase;


public class JunctionTest extends TestCase {
	  
	/**
	 * Test for the constructor
	 */
	public void testConstruction(){
		Junction junction = new Junction(true, "south");
		/*Checks if a junction was created*/
		assertNotNull(junction);
	}
	
	
	/**
	 * Tests that the constructor still works with
	 * the method setIcon implemented
	 */
	public void testConstructionIcon(){
		Junction junction = new Junction(true, "south");
		assertNotNull(junction);
	}
	
	
	/**
	 * Checks that the correct direction is set
	 */
	public void testGetCurrentDirection1(){
		Junction junction = new Junction(true, "north");
		assertEquals("north", junction.getCurrentDirection());
	}
	
	
	/**
	 * Checks that the correct direction is set
	 */
	public void testGetCurrentDirection2(){
		Junction junction = new Junction(true, "east");
		assertEquals("east", junction.getCurrentDirection());
	}
	
	
	/**
	 * Checks that the correct effect occurs when
	 * the junction is being clicked on
	 */
	public void testWasClicked1(){
		Junction junction = new Junction(true, "east");
		junction.wasClicked();
		assertEquals("west", junction.getCurrentDirection());
	}

	
	/**
	 * Checks that the correct effect occurs when
	 * the junction is being clicked on
	 */
	public void testWasClicked2(){
		Junction junction = new Junction(true, "south");
		junction.wasClicked();
		assertEquals("north", junction.getCurrentDirection());
	}
}
